from selenium import webdriver
from selenium.webdriver.chrome.options import  Options
from selenium.webdriver.common.by import  By
import  time

url = 'https://movie.douban.com/top250'

chrome_options = Options()
chrome_options.add_argument("--headless")

driver = webdriver.Chrome(options=chrome_options)
driver.get(url)
time.sleep(3)
moves_info = driver.find_elements(By.CLASS_NAME,'item')

move_data=[]
for move in moves_info:
    title = move.find_element(By.CLASS_NAME,'title').text
    rating = move.find_element(By.CLASS_NAME,'rating_num').text
    move_data.append({'title':title,'rating':rating})

driver.close()

print(move_data)


